package com.shop.cereshop.business.dl.logic.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.shop.cereshop.business.dao.dl.CareShopNewsForwardLogDAO;
import com.shop.cereshop.business.dl.logic.domian.CareShopNewsForwardLogVo;
import com.shop.cereshop.business.dl.logic.service.CareShopNewsForwardLogService;
import com.shop.cereshop.business.dl.logic.utils.ResultInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * @description
 * @Author YF
 * @Date 日期:2021/6/15 时间:16:15
 */
@Service
public class CareShopNewsForwardLogServiceImpl implements CareShopNewsForwardLogService {

    @Autowired
    private CareShopNewsForwardLogDAO careShopNewsForwardLogDAO;

    /**
     *
     * @description:商家端-资讯转发数据统计
     * @param
     * @return:
     *
     * @author:作者:YF
     * @time:日期:2021/6/15  时间:16:42
     */
    @Override
    public ResultInfo<CareShopNewsForwardLogVo> getNewsStatistics(Integer newsId, Integer page, Integer row) {
        //1.创建VO对象
        CareShopNewsForwardLogVo logVo = new CareShopNewsForwardLogVo();
        //2.封装用户转发列表，并返回, 使用limit进行分页
        logVo.setCareShopNewsForwardLoglist(careShopNewsForwardLogDAO.getNewsStatistics(newsId, (page-1)*row, row));
        //3.封装总次数
        logVo.setRepeatCount(careShopNewsForwardLogDAO.getNewsStatisticsCount(newsId));
        return new ResultInfo<>(logVo);
    }








}
